<template>
  <div class="home">
    <el-container class="homeWrapper">
      <el-aside width="200px">
        <!-- 侧边 -->
        <div class="logo">黑马头条</div>
        <!-- 侧边栏 -->
        <el-menu
          class="el-menu-vertical-demo"
          background-color="#6a5acd"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="2">
            <i class="el-icon-menu"></i>
            <span slot="title">文章编辑</span>
          </el-menu-item>

          <el-menu-item index="3">
            <i class="el-icon-setting"></i>
            <span slot="title">发布文章</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-container>
        <!-- 头部 -->
        <el-header>
          <img v-if="user" :src="$axios.defaults.baseURL+user.head_img" alt />
          <img v-else src="@/assets/logo.png" alt />
          <span>{{user.nickname}}</span>
        </el-header>

        <!-- 主体 -->
        <el-main>主体</el-main>
      </el-container>
    </el-container>

    <!-- <router-link to="/login">登录</router-link> -->
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      user: JSON.parse(localStorage.getItem("user"))
    };
  }
};
</script>
<style lang="less" scoped>
//饿了么组件容器
.homeWrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  //头部
  .el-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    line-height: 60px;
    padding: 50px 130px 50px 0;
    background: darkcyan;

    color: #fff;
    img {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      object-fit: cover;
    }
    span {
      margin-left: 30px;
      font-size: 36px;
      color: indianred;
    }
  }
  //侧标栏
  .el-aside {
    background-color: lightblue;
    text-align: center;
    line-height: 200px;
    color: #fff;
    .logo {
      padding-left: 30px;
      height: 100px;
      line-height: 100px;
      font-size: 40px;
      background: darkcyan;
      color: darkseagreen;
      font-weight: 700;
    }
  }
  //主体部分
  .el-main {
    background-color: powderblue;
    color: #000;
    font-size: 60px;
    text-align: center;
    line-height: 160px;
  }
  //饿了么容器
  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
}
</style>
